//
//  LZYPhotoCellTableViewCell.m
//  Supervisor
//
//  Created by 小宇 on 2017/5/18.
//  Copyright © 2017年 北京怀教网络科技股份有限公司. All rights reserved.
//

#import "LZYPhotoCell.h"

@implementation LZYPhotoCell

- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        [self _setupViews];
    }
    return self;
}

- (void)_setupViews {
    _icon = [[UIImageView alloc] init];
    _icon.clipsToBounds = YES;
    _icon.contentMode = UIViewContentModeScaleAspectFill;
    [self.contentView addSubview:_icon];
    
    _deleteButton = [[UIButton alloc] init];
    [_deleteButton setBackgroundImage:[UIImage imageNamed:@"delete"] forState:UIControlStateNormal];
    _deleteButton.alpha = 0.7;
    [_deleteButton addTarget:self action:@selector(clickDeleteButton) forControlEvents:UIControlEventTouchUpInside];
    [self.contentView addSubview:_deleteButton];
    
}

- (void)layoutSubviews {
    [super layoutSubviews];
    _icon.frame = CGRectMake(DeleteButtonWidth/2, DeleteButtonWidth/2, self.bounds.size.width - DeleteButtonWidth, self.bounds.size.width - DeleteButtonWidth);
    _deleteButton.frame = CGRectMake(self.bounds.size.width - 1.5 * DeleteButtonWidth, DeleteButtonWidth/2, DeleteButtonWidth, DeleteButtonWidth);
}

- (void)clickDeleteButton {
    !_ACMediaClickDeleteButton ?  : _ACMediaClickDeleteButton();
}
@end
